**Do file for "From Bullets to Boreholes: A Dis-aggregated Analysis of Domestic Water Cooperation in Drought-prone Regions"
**This do file was created with STATA/SE 15.1

**Last updated: November 23


*1. Analysis with "Water interactions" as dependent variable (DV):


*Model 1 
eststo: melogit nw_inci lnlgw_mean i.drought2 lnli_prec_gpcc li_nlights_calib_meanln lnli_pop_hyd_dens lv2x_partipdem lv2mebias i.capital li_temp i.FYD nw_inci_spl nw_inci_splSq nw_inci_splCu100  i.w_nw_inci  || gid:,  intpoints(10) or vce(cluster gwno)

*Model 2 adding Euro dummy
eststo: melogit nw_inci lnlgw_mean i.drought2 lnli_prec_gpcc li_nlights_calib_meanln lnli_pop_hyd_dens i.euro lv2x_partipdem lv2mebias i.capital li_temp i.FYD  nw_inci_spl nw_inci_splSq nw_inci_splCu100  i.w_nw_inci  || gid: ,  intpoints(10) or vce(cluster gwno)

*Model 3 without Europe cells
eststo: melogit nw_inci lnlgw_mean i.drought2 lnli_prec_gpcc  li_nlights_calib_meanln lnli_pop_hyd_dens i.FYD lv2x_partipdem lv2mebias i.capital li_temp  nw_inci_spl nw_inci_splSq nw_inci_splCu100  i.w_nw_inci  if euro==0 || gid: ,  intpoints(10) or vce(cluster gwno)

 
*FIGURE 3: Graph for Model 1 and 3 (DV = Water Interaction Incidence):
coefplot est1 est3, keep(lnlgw_mean 1.drought2 lnli_prec_gpcc ) xline(1) eform xtitle(Oddsratio) ciopts(recast(rcap))

eststo clear

*---------------------

*2. Analysis with "Water cooperation (non-state)" as DV:

*Model 1 
eststo:  melogit dum_coop lnlgw_mean i.drought2 lnli_prec_gpcc  i.lged_dum  li_nlights_calib_meanln lnli_pop_hyd_dens lv2x_partipdem lv2mebias i.capital li_temp i.FYD d_coop_spl d_coop_splSq d_coop_splCu100  i.w_dum_coop || gid:,  intpoints(10) or vce(cluster gwno)

*Model 2 adding euro dummy
eststo: melogit dum_coop lnlgw_mean i.drought2 lnli_prec_gpcc  i.lged_dum li_nlights_calib_meanln lnli_pop_hyd_dens i.euro lv2x_partipdem lv2mebias i.capital li_temp i.FYD d_coop_spl d_coop_splSq d_coop_splCu100  i.w_dum_coop || gid: ,  intpoints(10) or vce(cluster gwno)

*Model 3 without Europe cells
eststo: melogit dum_coop lnlgw_mean i.drought2 lnli_prec_gpcc  i.lged_dum li_nlights_calib_meanln lnli_pop_hyd_dens lv2x_partipdem lv2mebias i.capital li_temp i.FYD d_coop_spl d_coop_splSq d_coop_splCu100  i.w_dum_coop if euro==0  || gid: ,  intpoints(10) or vce(cluster gwno)


*FIGURE 5--Graphs for Model 1 and 3 (DV = Non-state Cooperation Incidence):
coefplot est1 est3, keep(lnlgw_mean 1.drought2 lnli_prec_gpcc) xline(1) eform xtitle(Oddsratio) ciopts(recast(rcap))
**

**Figure 6a Conditional effects between Groundwater and Democracy
melogit dum_coop c.lnlgw_mean#c.lv2x_partipdem  lnlgw_mean lv2x_partipdem  i.drought2 lnli_prec_gpcc  i.lged_dum li_nlights_calib_meanln lnli_pop_hyd_dens lv2mebias i.capital li_temp i.FYD d_coop_spl d_coop_splSq d_coop_splCu100  i.w_dum_coop || gid: ,  intpoints(10) or vce(cluster gwno) 
margins, dydx(c.lnlgw_mean) at(c.lv2x_partipdem=(0.01(0.05).8) (means)) post 
marginsplot, scheme(s2mono) recast(line) recastci(rarea) addplot(histogram lv2x_partipdem if lv2x_partipdem>=0.01 & lv2x_partipdem<=8 & sample==1,  bcolor(none) yaxis(2)) legend(off)
*

*FIGURE 6b Conditional effects between Groundwater and Democracy (outside Europe)
melogit dum_coop c.lnlgw_mean#c.lv2x_partipdem  lnlgw_mean lv2x_partipdem  i.drought2 lnli_prec_gpcc  i.lged_dum li_nlights_calib_meanln lnli_pop_hyd_dens lv2mebias i.capital li_temp i.FYD d_coop_spl d_coop_splSq d_coop_splCu100  i.w_dum_coop if euro==0 || gid: ,  intpoints(10) or vce(cluster gwno) 
margins, dydx(c.lnlgw_mean) at(c.lv2x_partipdem=(0.01(0.05).56) (means)) post 
marginsplot, scheme(s2mono) recast(line) recastci(rarea) addplot(histogram lv2x_partipdem if lv2x_partipdem>=0.01 & lv2x_partipdem<=.55 & sample==1 & euro==0,  bcolor(none) yaxis(2)) legend(off)
*


eststo clear

*---------------------

*3. Analysis with "Water cooperation (state-based)" as DV:



*Model 1
eststo: melogit dum_Scoop lnlgw_mean i.drought2 lnli_prec_gpcc  i.lged_dum i.lw_ged_dum li_nlights_calib_meanln lnli_pop_hyd_dens lv2x_partipdem lv2mebias i.capital li_temp i.FYD d_Scoop_spl d_Scoop_splSq d_Scoop_splCu100 i.w_Sdum_coop || gid:,  intpoints(10) or vce(cluster gwno)

*Model 2 adding euro dummy
eststo: melogit dum_Scoop lnlgw_mean i.drought2 lnli_prec_gpcc  i.lged_dum  i.lw_ged_dum li_nlights_calib_meanln lnli_pop_hyd_dens i.euro lv2x_partipdem lv2mebias i.capital li_temp i.FYD d_Scoop_spl d_Scoop_splSq d_Scoop_splCu100 i.w_Sdum_coop || gid: ,  intpoints(10) or vce(cluster gwno)

*Model 3 without Europe cells
eststo: melogit dum_Scoop lnlgw_mean i.drought2 lnli_prec_gpcc  i.lged_dum i.lw_ged_dum li_nlights_calib_meanln lnli_pop_hyd_dens lv2x_partipdem lv2mebias i.capital li_temp  d_Scoop_spl d_Scoop_splSq d_Scoop_splCu100 i.w_Sdum_coop if euro==0 || gid:,  intpoints(10) or vce(cluster gwno)

*Model 4 robust standard errors
eststo: melogit dum_Scoop lnlgw_mean i.drought2 lnli_prec_gpcc  i.lged_dum i.lw_ged_dum li_nlights_calib_meanln lnli_pop_hyd_dens lv2x_partipdem lv2mebias i.capital li_temp d_Scoop_spl d_Scoop_splSq d_Scoop_splCu100 i.w_Sdum_coop if euro==0 || gid: ,  intpoints(10) or vce(robust)

*FIGURE 3--Graphs for Model 1 and 3 (DV = State-based Cooperation Incidence):
coefplot est2 est3, keep(lnlgw_mean 1.drought2 lnli_prec_gpcc 1.lged_dum) xline(1) eform xtitle(Oddsratio) ciopts(recast(rcap))
**

